Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [M3-8553] - DisplayPrice story crash when Currency component's minimumFractionDigits is negative #10913

Conversation

pmakode-akamai
Copy link
Contributor

@pmakode-akamai pmakode-akamai commented Sep 10, 2024

Description 📝

The Storybook for DisplayPrice is crashing when the minimumFractionDigits in the Currency component is set with a negative value.

This PR addresses the issue by updating the Currency component to handle negative decimalPlaces props correctly. Specifically, it ensures that the minimumFractionDigits defaults to 2 when the decimalPlaces prop is negative or undefined.

Changes 🔄

  • Handle negative decimalPlaces prop in Currency component to fix DisplayPrice story
    • The minimumFractionDigits in the Currency component will now use the default value (2) when decimalPlaces prop is negative or undefined.
  • Add a unit test case to cover the above scenario.
  • Update all other unit test cases for more clarity.

Target release date 🗓️

N/A

How to test 🧪

Reproduction steps

  • Go to the DisplayPrice storybook
  • Enter a negative value for decimalPlaces prop

Verification steps

  • Run storybook locally and verify that the Story for DisplayPrice should not crash when the decimalPlaces prop is negative.
  • Confirm that the The minimumFractionDigits in the Currency component uses the default value (2) when decimalPlaces prop is negative or undefined.
  • Verify that all the unit test cases pass.

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@pmakode-akamai pmakode-akamai self-assigned this Sep 10, 2024
@pmakode-akamai pmakode-akamai requested a review from a team as a code owner September 10, 2024 07:59
@pmakode-akamai pmakode-akamai requested review from hana-akamai, carrillo-erik and coliu-akamai and removed request for a team September 10, 2024 07:59
@pmakode-akamai pmakode-akamai changed the title fix: [M3-8553] - DisplayPrice story crash when Currency Component's minimumFractionDigits is Negative fix: [M3-8553] - DisplayPrice story crash when Currency component's minimumFractionDigits is Negative Sep 10, 2024
@pmakode-akamai pmakode-akamai changed the title fix: [M3-8553] - DisplayPrice story crash when Currency component's minimumFractionDigits is Negative fix: [M3-8553] - DisplayPrice story crash when Currency component's minimumFractionDigits is negative Sep 10, 2024
@pmakode-akamai pmakode-akamai added the Bug Fixes for regressions or bugs label Sep 10, 2024
Copy link

github-actions bot commented Sep 10, 2024

Coverage Report:
Base Coverage: 86.4%
Current Coverage: 86.4%

Copy link
Contributor

@coliu-akamai coliu-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great + thanks for adding additional test coverage! 🎉

@coliu-akamai coliu-akamai added the Add'tl Approval Needed Waiting on another approval! label Sep 10, 2024
@hana-akamai hana-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! Ready for Review labels Sep 10, 2024
@pmakode-akamai pmakode-akamai merged commit 8d028f9 into linode:develop Sep 11, 2024
19 checks passed
nikhagra-akamai pushed a commit to nikhagra-akamai/manager that referenced this pull request Sep 23, 2024
…minimumFractionDigits` is negative (linode#10913)

* Handle neg digits prop in Currency component to fix DisplayPrice story crash

* Added changeset: DisplayPrice story crash when Currency component's minimumFractionDigits is Negative

* Update the changeset file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Bug Fixes for regressions or bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants